主题
添加VMware DMA设备 - DmaAddDevice
函数简介
添加 VMware DMA 设备,使用默认连接字符串快速添加 VMware 虚拟机作为 DMA 设备。(高级版功能,普通版无法使用)
接口名称
DmaAddDeviceDLL调用
c
int64_t OLA_CALL_TYPE DmaAddDevice(int64_t instance, int32_t vmId);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| instance | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| vmId | 整数型 | VMware虚拟机ID (vmware-vmx.exe 进程PID) , 不是vmware.exe这个进程 . 虚拟机配置文件 *.vmx 加上 mainMem.useNamedFile = "TRUE" |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);csharp
using OLAPlug;
var ola = new OLAPlugServer();
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
# vmId 为 VMware 虚拟机 ID
deviceId = ola.DmaAddDevice(1)java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);go
import "github.com/ola/olaplug/olaplug"
ola, _ := olaplug.NewOLAPlugServer("OLAPlug_x64.dll")
defer ola.ReleaseObj()
// vmId 为 VMware 虚拟机 ID
deviceId := ola.DmaAddDevice(1)rust
use olaplug::OLAPlugServer;
let ola = OLAPlugServer::new("OLAPlug_x64.dll").unwrap();
// vmId 为 VMware 虚拟机 ID
let deviceId = ola.dma_add_device(1);cpp
var ola = com("OlaPlug.OlaSoft")
// vmId 为 VMware 虚拟机 ID
var deviceId = ola.DmaAddDevice(1)vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' vmId 为 VMware 虚拟机 ID
deviceId = ola.DmaAddDevice(1)text
.局部变量 ola, OLAPlug
ola.创建 ()
' vmId 为 VMware 虚拟机 ID
deviceId = ola.DmaAddDevice(1)aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// vmId 为 VMware 虚拟机 ID
var deviceId = ola.DmaAddDevice(1);text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// vmId 为 VMware 虚拟机 ID
长整数 deviceId = ola.DmaAddDevice(1)cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDevice(instance, 1);csharp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDevice(instance, 1);python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
deviceId = DmaAddDevice(instance, 1)返回值
| 返回值 | 说明 |
|---|---|
| (返回值) | 长整数型:成功返回设备ID (>=0),失败返回 -1。 |
